package com.steven.io;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class CopyPic {
	
	public static void main(String[] args)     {
		FileOutputStream fos = null;
		FileInputStream fis =null;
		try {
			fos = new FileOutputStream("c:\\1111.png");
			fis = new  FileInputStream("c:\\11.png");
			
		byte[] buf = new byte[1024];
			int len =0;
			
			try {
				while((len=fis.read())!=-1){
					fos.write(len);
					
				}
//				while((len=fis.read(buf))!=-1){
//					fos.write(buf, 0, len);
//					
//					
//				}
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}finally{
				try {
					fos.close();
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				try {
					fis.close();
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			
			
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}

}
